package cn.cs.mapper;

import cn.cs.pojo.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

@Mapper
public interface RepairOrderMapper {
	//获取预约单信息
	public List<Map<String, Object>> getAppOrder(@Param(value = "userId") String userId) throws Exception;

	//获取订单信息
	public List<Map<String, Object>> getRepairOrder(@Param(value = "userId") String userId) throws Exception;

	//根据订单状态获取预约单信息
	public List<Map<String, Object>> getAppOrderByOrderState(@Param(value = "orderState") String orderState) throws Exception;

	//根据订单状态获取订单信息
	public List<Map<String, Object>> getRepairOrderByOrderState(@Param(value = "orderState") String orderState) throws Exception;

	public List<RepairOrder> getRepairOrderList(Map<String, Object> param) throws Exception;

	public Map<String, Object> getRepairOrderById(@Param(value = "id") String id) throws Exception;

	public RepairOrder getRepOrderById(@Param(value = "id") String id) throws Exception;

	public List<RepairOrder> getRepairOrderListByMap(Map<String, Object> param) throws Exception;

	public List<Map<String, Object>> getAppOrderAllByMap(Map<String, Object> param) throws Exception;

	public Integer getRepairOrderCountByMap(Map<String, Object> param) throws Exception;

	public Integer insertRepairOrder(RepOrder repairOrder) throws Exception;

	public Integer updateRepairOrder(RepairOrder repairOrder) throws Exception;

	public Integer deleteRepairOrderById(@Param(value = "id") Long id) throws Exception;

	/**
	 * 根据用户ID查询预约单信息
	 */
	public List<Map<String, Object>> getAppOrderByUserId(@Param(value = "userId") String userId);

	/**
	 * 根据用户Id 查询用户所下过预约单类型
	 * @param userId
	 * @return
	 */
	public List<String> getUserOrderType(@Param(value = "userId") String userId);

	/**
	 * 根据用户Id分页查询预约单信息
	 *
	 * @param map
	 * @return
	 */
	public List<Map<String, Object>> getAppOrderByMap(Map<String, Object> map);

	/**
	 * 支付成功修改订单状态
	 */
	public Integer updateRapairOrderStatus(RepOrder repOrder);

	/**
	 * 修改用户余额信息
	 */
	public Integer updateUserBalance(@Param(value = "balance") Double balance, @Param(value = "id") String id);

	/**
	 * 根据订单查找预约单的id，修改预约单状态
	 */
	public Integer updateAppOrderStatus(@Param(value = "orderId") String orderId, @Param(value = "order_state") String order_state);

	/**
	 * 修改维修工的星级
	 * @param star
	 * @return
	 */
	public Integer updateRepairUserStar(@Param(value = "star") Long star, @Param(value = "orderId") String orderId);
	/**
	 * 插入余额变动信息
	 */
	public Integer insertAccoutDetails(AccountDetail accountDetail);

	/**
	 * 根据订单ID查询账单的全部信息
	 */
	public List<Map<String, Object>> getOrderDetailsByOrderId(@Param(value = "orderId") String orderId, @Param(value = "type") String type);

	public List<Map<String, Object>> getBillOrderImgByOrderId(@Param(value = "orderId") String OrderId);

	public Map<String, Object> getBillOrderDetailsByOrderId(@Param(value = "orderId") String OrderId);


	/**
	 * 根据用户ID查找当前用户的账户余额
	 */
	public ClientUser getUserBalanceByUserId(@Param(value = "userId") String userId);

	public Integer updateOrderStatusByAppId(@Param(value = "order_state") String order_state, @Param(value = "appId") String appId);

	public Integer updateUserOrderNumber(@Param(value = "id") String id) throws Exception;

	public Map<String, Object> getOrderByAppOrderId(@Param(value = "app_order_id") String app_order_id);

	public List<Map<String, Object>> getAppOrderAllRepairUserByMap(Map<String, Object> param) throws Exception;

	public Integer getRepairOrderRepairUserCountByMap(Map<String, Object> param) throws Exception;

	public List<RepairOrder> getAppOrderAgentAByMap(Map<String, Object> param) throws Exception;

	public Integer getAppOrderAgentACountByMap(Map<String, Object> param) throws Exception;

	public List<RepairOrder> getAppOrderAgentBByMap(Map<String, Object> param) throws Exception;

	public Integer getAppOrderAgentBCountByMap(Map<String, Object> param) throws Exception;

	public Double getAppOrderAgentAProfitAll(Map<String, Object> param) throws Exception;

	public Double getAppOrderAgentBProfitAll(Map<String, Object> param) throws Exception;

	public Map<String, Object> getSetPolicyByType(String type);

	public ClientUser getClientUserById(@Param(value = "id") Long id)throws Exception;

	public List<AfterOrder> getAfterOrderByOrderId(@Param(value = "orderId") String orderId) throws Exception;

	//获取检测报告订单
	public Map<String, Object> getTestReportById(@Param(value = "id") String id)throws Exception;

	//支付成功修改检测报告订单状态
	public Integer updateTestReportStatus(@Param(value = "rep_order_id") String rep_order_id, @Param(value = "app_order_id") String app_order_id, @Param(value = "id") String id)throws Exception;

	public Integer updateRepOrderStatusMoney(Map<String, Object> param)throws Exception;

	public List<Map<String, Object>> getOrderByRepUserId(@Param(value = "rep_user_id") String rep_user_id)throws Exception;


	public List<Map<String, Object>> getInsurancePremiumByMap(Map<String, Object> param) throws Exception;

	public Map<String, Object> getInsurancePremiumCount(Map<String, Object> param) throws Exception;

	public Integer updateOrderStateAAgent(@Param(value = "id") String id)throws Exception;

	public Integer updateOrderStateBAgent(@Param(value = "id") String id)throws Exception;

	public Double getAppOrderAgentAProfitAllNew(Map<String, Object> param) throws Exception;

	public List<Map<String, Object>> getAppOrderAgentAByMapNew(Map<String, Object> param) throws Exception;

	//获取维修订单
	public Map<String, Object> getOrderById(@Param(value = "id") String id)throws Exception;

	//支付成功修改维修订单状态
	public Integer updateOrderStatus(@Param(value = "id") String id, @Param(value = "app_order_id") String app_order_id, @Param(value = "agentAId") String agentAId, @Param(value = "agentBId") String agentBId)throws Exception;


}
